package com.zhangjingcheng.yunyixia.controller;

import com.zhangjingcheng.yunyixia.service.PreviewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/preview")
@Api(tags = "预览接口")
public class PreviewController {

    @Autowired
    private PreviewService previewService;

    /**
     * 预览文件
     *
     * @param id
     * @param request
     * @param response
     */
    @ApiOperation("预览文件")
    @GetMapping("/view")
    public void view(Integer id, HttpServletRequest  request, HttpServletResponse response) {
        previewService.preview(id,request, response);
    }

}
